<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <button @click="fn">点我显示或隐藏</button>
        <div v-show="flag">{{msg}}</div>
    </div>
    <script src="./vue.js"></script>
    <script>
        const app = new Vue({
            el:'#app',
            data:{
                msg:'显示的内容',
                flag:false
            },
            methods:{
                // methods里面的所有函数,this都指向实例
                fn(){
                    console.log(app = this)
                    this.flag = !this.flag
                }
            }
        })
    </script>
</body>
</html>